<!DOCTYPE html>

<html lang="en-US">
<@common.header/>
<script src="gt.js"></script>
<body class="page-sub-page page-create-account page-account" id="page-top">
<!-- Wrapper -->
<div class="wrapper">
    <!-- Navigation -->
    <@common.nav/>
    <!-- end Navigation -->
    <!-- Page Content -->
    <div id="page-content">
        <!-- Breadcrumb -->
        <div class="container">
            <ol class="breadcrumb">
                <li><a href="#">主页</a></li>
                <li class="active">登录</li>
            </ol>
        </div>
        <!-- end Breadcrumb -->

        <div class="container">
            <header><h1>登录</h1></header>
            <div class="row">
                <div class="col-md-4 col-sm-6 col-md-offset-4 col-sm-offset-3">
                    <form role="form" id="form-create-account" method="post" action="/accounts/signin" style="font-size: 20px;font-weight: 500">
                        <div class="form-group" style="margin-top: 15px;">
                            <label for="form-create-account-email"><font color="red">*</font>账号:</label>
                            <input type="text"  name="username" value="${username!}" class="form-control" id="phone" required>
                        </div><!-- /.form-group -->
                        <div class="form-group" style="margin-top: 15px;">
                            <label for="form-create-account-password"><font color="red">*</font>密码:</label>
                            <input type="password" name="password" value="${password!}" class="form-control" id="form-create-account-password" required>
                        </div><!-- /.form-group -->
                        <div class="form-group" style="margin-top: 15px;">
                            <label for="form-create-account-email"><font color="red">*</font>短信验证码:</label>
                            <div class="input-group">
                                <input type="text" class="form-control" name="smscode" placeholder="请输入验证码"  required>
                                <span class="input-group-btn">
                                        <a id="sendMsgBtn" class="btn btn-default" type="button"  onclick="sendMsg();" >获取短信验证码</a>
                                      </span>
                            </div><!-- /input-group -->

                        </div>
                        <input type="hidden" value="${target!}" name="target" />
                        <div class="form-group clearfix" style="text-align: center;margin-top: 15px;">
                            <button type="submit" class="btn center btn-default" id="account-submit">登录</button>&nbsp;&nbsp;&nbsp;
                            <button type="submit" class="btn center btn-default" id="account-submit" onclick="openRemember()">忘记密码</button>
                        </div><!-- /.form-group -->
                    </form>


                </div>
            </div>
           
        </div><!-- /.container -->
    </div>
    <!-- end Page Content -->
    <!-- Page Footer -->
    <@common.footer/>
    <!-- end Page Footer -->
</div>

<@common.js/>
<!--[if gt IE 8]>
<script type="text/javascript" src="/assets/js/ie.js"></script>
<![endif]-->
 <script  type="text/javascript" >
     var count=60;
     var Icon;
       $(document).ready(function() {
          var errorMsg   = "${errorMsg!""}";
          var successMsg = "${successMsg!""}";
          if(errorMsg){ 
              errormsg("error",errorMsg);
          }
          if(successMsg) {
              successmsg("success",successMsg);
          }
        })

       function sendMsg(){
           var phone = $("#phone").val();
           if(phone == null || phone ==""){
               errormsg("error","手机号不能为空");
           }else{
               $.get("/accounts/sendRegistCode?phone="+phone);
               successmsg("验证码","验证码已发送注意查收");
               $("#sendMsgBtn").attr("disabled", "disabled");
               Icon = setInterval(showSecond,1000);

           }

       }

       function showSecond() {
           $("#sendMsgBtn").html(count);
           count--;
           if(count<0){
               window.clearInterval(Icon);
               $("#sendMsgBtn").attr("disabled",false);
               $("#sendMsgBtn").html("获取短信验证码");
               count =60;
           }
       }
    function openRemember(){
        var email = document.getElementById('form-create-account-email');
        window.open('/accounts/remember?username='+email.value);
    }
        
 </script>
    }
</body>
</html>